<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>mlist</title>
  </head>
  <body bgcolor="#FFFFFF">
    <center>Scilab Function</center>
    <div align="right">Last update : 05/01/2005</div>
    <p>
      <b>mlist</b> - Scilab object, matrix oriented typed list
  definition.</p>
    <h3>
      <font color="blue">Calling Sequence</font>
    </h3>
    <dl>
      <dd>
        <tt>mlist(typ,a1,....an )</tt>
      </dd>
    </dl>
    <h3>
      <font color="blue">Parameters</font>
    </h3>
    <ul>
      <li>
        <tt>
          <b>typ</b>
        </tt>: vector of character strings</li>
      <li>
        <tt>
          <b>ai</b>
        </tt>: any Scilab object (<tt>
          <b>matrix, list,string...</b>
        </tt>).</li>
    </ul>
    <h3>
      <font color="blue">Description</font>
    </h3>
    <p>mlist object are very similar to tlist objects. But if <tt>
        <b>M</b>
      </tt>
    is an mlist, for any index <tt>
        <b>i</b>
      </tt> which is not a field name,
    <tt>
        <b>M(i)</b>
      </tt> is not the <tt>
        <b>i</b>
      </tt>th field of the list but is
    interpreted as the <tt>
        <b>i</b>
      </tt> th entry of <tt>
        <b>M</b>
      </tt> seen as a
    vector. This is the only difference between <tt>
        <b>mlist</b>
      </tt> and
    <tt>
        <b>tlist</b>
      </tt>.</p>
    <p>mlist fields must then be designed by their names. They can also be
    handled using the <tt>
        <b>getfield</b>
      </tt> and <tt>
        <b>setfield</b>
      </tt>
    functions.</p>
    <h3>
      <font color="blue">Examples</font>
    </h3>
    <pre>

M=mlist(['V','name','value'],['a','b','c'],[1 2 3]);
//define display
deff('%V_p(M)','disp(M.name+'':''+string(M.value))')
//define extraction operation
deff('r=%V_e(i,M)',..
'r=mlist([''V'',''name'',''value''],M.name(i),M.value(i))')
M(2) // the second entry of the vector M
M.value 

//define M as a tlist
M=tlist(['V','name','value'],['a','b','c'],[1 2 3]);
M(2)

M('name')

//with two  indices
M=mlist(['V','name','value'],['a','b';'c' 'd'],[1 2;3 4]);
deff('r=%V_e(varargin)',[
    'M=varargin($)';
    'H=[''V'',''name'',''value'']'
    'r=mlist(H,M.name(varargin(1:$-1)),M.value(varargin(1:$-1)))'])

M(:,2)
// multidimensionnal array
str=['a','b','c','d','e','f','g','h'];
n=hypermat([2,2,2],str);
v=hypermat([2,2,2],1:8);
M=mlist(['V','name','value'],n,v);
M(1,1:2,2)
 
  </pre>
    <h3>
      <font color="blue">See Also</font>
    </h3>
    <p>
      <a href="tlist.htm">
        <tt>
          <b>tlist</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="list.htm">
        <tt>
          <b>list</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="overloading.htm">
        <tt>
          <b>overloading</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="getfield.htm">
        <tt>
          <b>getfield</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="setfield.htm">
        <tt>
          <b>setfield</b>
        </tt>
      </a>,&nbsp;&nbsp;</p>
  </body>
</html>
